<template>
  <div id="app" :class="[$route.path == '/404' ? 'bgc' : '']">
    <div class=" ">
      <div class="view-main">
        <router-view />
      </div>
    </div>
  </div>
</template>

<script>
// import Header from "@/components/Header";
// import WebSocketObj from "@/utils/wsConnect";
export default {
  name: "App",
  components: {
    // Header,
  },
  data() {
    return {
      scale: 1,
      isPhone: false, // socket参数
      webSocket: null,
      wsOpen: true, //
      timeoutScreen: null, //多屏状态重连倒计时
      isLoading: false,
    };
  },
  watch: {
    $route: {
      handler(val) {},
      deep: true,
    },
  },
  mounted() {
    //立即执行显示分辨率设置方法
    this.$nextTick(() => {
      // this.setScreen();
      // window.addEventListener("resize", this.setScreen.bind(this)); // 监听到变化  再次调自己
    });
  },
  methods: {
    setScreen() {
      // 可视区域的尺寸
      let visibleWidth = window.innerWidth;
      let visibleHeight = window.innerHeight;
      // 手动配置的面板尺寸
      let manualWidth = 1280;
      let manualHeight = 800;
      // 计算横向和纵向的缩放系数
      var widthPercentage = (1.0 * visibleWidth) / manualWidth;
      var heightPercentage = (1.0 * visibleHeight) / manualHeight;
      // 取得最小缩放系数
      if (visibleWidth < visibleHeight) {
        this.scale = 0.5;
        this.isPhone = true;
      } else {
        this.isPhone = false;
        this.scale = Math.min(widthPercentage, heightPercentage);
      }
    },
  },
  beforeDestroy() {},
};
</script>

<style lang="scss" scoped>
@media screen and (orientation: landscape) {
}
#app {
  position: relative;
  // width: 100%;
  // height: 100%;

  .scale_body {
    width: 1280px;
    height: 800px;
    position: absolute;
    pointer-events: all;
    padding: 0 100px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    overflow: hidden;
  }
  .loading_body {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: auto;
    margin: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    .con_body {
      width: 550px;
      height: 30%;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      justify-content: flex-end;
      background: rgba(39, 42, 44, 0.79);
      border-radius: 9px 9px 9px 9px;
      border: 1px solid #7b7b7b;
      font-weight: bold;
      font-size: 26px;
      color: #ffffff;
      text-align: center;
      .con {
        width: 100%;
        .loader {
          width: fit-content;
          font-weight: bold;
          font-size: 26px;
          color: #ffffff;
          clip-path: inset(0 5.4ch 0 0);
          animation: l4 1s steps(4) infinite;
        }
        .loader:before {
          content: "正在连接中。。。";
        }
        @keyframes l4 {
          to {
            clip-path: inset(0 -1ch 0 0);
          }
        }
      }
      .btn_body {
        width: 80px;
        height: 30px;
        margin: 70px 10px 13px;
        overflow: hidden;
        text-align: center;
        background: linear-gradient(
          to top,
          rgba(130, 143, 168, 0.3) 0%,
          rgba(51, 56, 66, 0.5) 50%
        );
        box-shadow: 0px 0px 5px 0px rgba(70, 141, 255, 0.52);
        border-radius: 9px 9px 9px 9px;
        border: 1px solid #7b7b7b;
        line-height: 30px;
        font-size: 14px;
        color: #ffffff;
        &:active {
          background: #27282c;
          color: #3d7fe8;
        }
      }
    }
  }
}
.appclass {
  width: 100vh;
  height: 100vw;
  transform: rotateZ(90deg);
}
.bgc {
  background: #fff !important;
}
.bodyclass {
  width: 1280px;
  height: 800px;
  position: absolute;
  pointer-events: all;
  left: 50%;
  top: 76%;
  transform: translate(-50%, -50%);
  overflow: hidden;
}
</style>
